/**
 * @param {string} s
 * @return {boolean}
 */
 var isValid = function(s) {
    let map = new Map([
        [')','('],
        ['}','{'],
        [']','[']
        ])
    let stack = []
    for(let ch of s){
        if(map.has(ch)){
            if(map.get(ch) != stack[stack.length-1] ){
                return false
            }
            stack.pop()

        }else{
            stack.push(ch)
        }
    }
    return !stack.length
};